fix(toolkit): keep source DB intact when DbMove copy fails - #140
fix(toolkit): keep source DB intact when DbMove copy fails#140halibobo1205 wants to merge 1 commit into
Conversation
🤖 CodeAnt AI — Review Status
|
Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
e106186 to
6e2d1c1
Compare
Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
6e2d1c1 to
1123021
Compare
Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
1123021 to
eb05a4a
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: eb05a4a8fd
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
bce2891 to
7315661
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7315661a1b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } | ||
|
|
||
| AtomicBoolean hasError = new AtomicBoolean(false); | ||
| try (Stream<Path> files = Files.walk(p.original)) { |
There was a problem hiding this comment.
Reject destinations nested under their source
When a configured destination resolves beneath the source database, mkdirs() creates that destination before this recursive walk begins, so the walk can discover the directories that copyEntry() is generating and repeatedly copy the destination into itself until a path-length or disk-space failure occurs. Validate that p.destination does not start with p.original before starting the recursive copy.
Useful? React with 👍 / 👎.
| headerHeading = "All `db` tools operate directly on the database files.\n" | ||
| + " Before performing a database operation,\n" | ||
| + "you must stop the currently running FullNode service.\n", |
There was a problem hiding this comment.
Put the safety warning in the actual header
When users run Toolkit db --help, this warning is omitted: headerHeading is only the label preceding a non-empty header section, and this command does not define any header values, as described by picocli's Command API. Use header (or another rendered help section) so the newly added stop-FullNode warning is actually visible.
Useful? React with 👍 / 👎.
Prevent the prior flow from deleting source databases after logging and ignoring per-file copy errors. Preserve every source until all configured databases copy successfully. Roll back partial destinations, handle recursive database contents, and return a non-zero status on failure. Finalize symlinks only after the copy phase completes, report completion once, and cover rollback and direct retry behavior.
7315661 to
cc85dc5
Compare
User description
Prevent the prior flow from deleting source databases after logging and ignoring per-file copy errors.
Preserve every source until all configured databases copy successfully. Roll back partial destinations, handle recursive database contents, and return a non-zero status on failure.
Finalize symlinks only after the copy phase completes, report completion once, and cover rollback and direct retry behavior in DbMoveTest.
CodeAnt-AI Description
Make database moves fail safely and preserve source data
What Changed
Impact
✅ Source databases preserved after failed moves✅ No partial destination copies after copy errors✅ Recursive database contents retained during moves💡 Usage Guide
Checking Your Pull Request
Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.
Talking to CodeAnt AI
Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:
This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.
Example
Preserve Org Learnings with CodeAnt
You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:
This helps CodeAnt AI learn and adapt to your team's coding style and standards.
Example
Retrigger review
Ask CodeAnt AI to review the PR again, by typing:
Check Your Repository Health
To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.